package com.efuture.io;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @ClassNAME BufferedWriterTest
 * @Description BufferedWriter的使用
 * @Author zhaoshanshan
 * @Date 2021/9/8 8:47 下午
 * @Version 1.0
 */
public class BufferedWriterTest {

    public static void main(String[] args) {
        BufferedWriter bw = null;
        try {
            bw = new BufferedWriter(new FileWriter("javasestudy/src/com.efuture.io/TestFileFour.txt",true));
            String s = "我是BufferedWriter的使用\n你会用我吗?";
            bw.write(s);
            bw.flush();
        }catch (Exception e){
            e.getStackTrace();
        }finally {
            if(null!=bw){
                try {
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}